Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.EventsManager = undefined;
var exp_EventsManager = /* */function () {
  function _ctor() {
    babel_classCallCheck(this, _ctor);
  }
  babel_createClass(_ctor, null, [{
    key: "on",
    value: function on(e, t) {
      if (_ctor._eventsMap[e]) {
        _ctor._eventsMap[e].push(t);
      } else {
        _ctor._eventsMap[e] = [t];
      }
    }
  }, {
    key: "off",
    value: function off(e, t) {
      if (_ctor._eventsMap[e]) {
        var _a15 = _ctor._eventsMap[e];
        var i = 0;
        for (; i < _a15.length;) {
          if (_ctor._eventsMap[e][i] === t) {
            _ctor._eventsMap[e].splice(i, 1);
          } else {
            i++;
          }
        }
      }
    }
  }, {
    key: "offAll",
    value: function offAll(e) {
      _ctor._eventsMap[e] && delete _ctor._eventsMap[e];
    }
  }, {
    key: "emit",
    value: function emit(e, t) {
      _ctor._eventsMap[e] && _ctor._eventsMap[e].forEach(function (e) {
        e(t);
      });
    }
  }]);
  return _ctor;
}();
exports.EventsManager = exp_EventsManager;
exp_EventsManager._eventsMap = {};